<%-- 
  - Author: Abed Yaseen
  - Date: 02-Jan-2012
  - Copyright Notice: TRAKHEES
  - Description: show.jsp
 --%>
<%@ include file="/WEB-INF/view/include.jsp"%>
	

      <div class="t_company-profile-container">
		  <div class="t_company-profile-container_hdr">      
        	<h1 class="t_company-name"><spring:message code="label.company_profile" /></h1> <h2 class="t_company-info"><spring:message code="label.company_information" /></h2>
		  </div>  
		  <div style="color: red;font-size: 15px;">
		  	  	<c:if test="${(CompanyInformationInfo.gsError)}">
					<li><spring:message code="gs.inactive.msg" /></li>
				</c:if>
				<c:if test="${(CompanyInformationInfo.fnpError)}">
					<li><spring:message code="fnp.inactive.msg" /></li>
				</c:if>
				 <c:if test="${(CompanyInformationInfo.companyError)}">
					<li><spring:message code="lic.inactive.msg" /></li>
				</c:if>
		  </div>      	
          <div class="t_heading-colum">
            <ul>
                <li><spring:message code="label.company_name" /></li>
                <li><spring:message code="label.licence_no" /></li>
                <li><spring:message code="label.reqAllowed" /></li>
                <li><spring:message code="label.allowed" /></li>
               	<c:if test="${isCompanyAdmin == true || (CompanyInformationInfo.medicalType!=null && !empty CompanyInformationInfo.medicalType)}">
					<li><spring:message code="label.medical_type" /></li>
				</c:if>
            </ul>
          </div>
          <div class="t_detail-colum">
            <ul>
               	<c:if test="${(CompanyInformationInfo.companyLicenseNo!=null || !empty CompanyInformationInfo.companyLicenseNo)}">
               			<c:choose>
	               			<c:when	test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<li>${CompanyInformationInfo.companyNameAr}</li>
							</c:when>
							<c:otherwise>
								<li>${CompanyInformationInfo.companyName}</li>
							</c:otherwise>
						</c:choose>
					  	<li>${CompanyInformationInfo.companyLicenseNo }</li>
                		<li><fmt:formatNumber value="${CompanyInformationInfo.requiredAllowed}"  pattern="${numberPattern}" /></li>
                 		<li><fmt:formatNumber value="${CompanyInformationInfo.allowed}"  pattern="${numberPattern}" /></li>
                
                		<c:choose>
		                	<c:when test="${CompanyInformationInfo.medicalType==null || empty CompanyInformationInfo.medicalType}">
								<c:if test="${isCompanyAdmin}">
									<li  id=showMedicalTypeBeforeSelect>
										<div class="t_fin-black-txt_nom">	
												<div id= showMedicalTypeBeforeSelect_Sub class="t_fin-black-txt_float">	
													<select id="medicalType" name="medicalListSelectCode" class="t_grid-table" onchange="changed(this)">
														<c:forEach var="item" items="${medicalList}">
															<option value="${item.id}">${item.labelEn}</option>
														</c:forEach>
													</select>
												</div>
												<button type="button" class="button_small" onclick="submit();"><spring:message code="button.submit" /></button>        
										</div>
									</li>                
					                <li id=showMedicalTypeAfterSelect>
					                </li>
		                		</c:if>
		                	</c:when>
		                	<c:otherwise>
								<li>${medicalMap[CompanyInformationInfo.medicalType]}</li>                	
		                	</c:otherwise>                  
						</c:choose>
					</c:if>
            </ul>
          </div>
          <%-- <img class="t_view-profile-btn" src="resources/images/view-profile-btn.png" alt="" />--%> </div>
      <div class="t_tfinancial-cont">
      <div class="t_financial-top"><spring:message code="label.financial_info" /></div>
      <table style="width: 80%" border="0">
      	<tr><td>
      		<table border="0" >
      			<tr><td><div class="t_fin-black-txt"><spring:message code="label.bg_req" /></div></td></tr>
      			<tr><td><div class="t_fin-black-txt"><spring:message code="label.bg_paid" /></div></td></tr>
      			<tr><td><div class="t_fin-black-txt"><spring:message code="label.bg_bal" /></div></td></tr>
      			<tr><td><div class="t_fin-black-txt"><spring:message code="label.prepaid_reserve_account" /></div></td></tr>
      			<tr><td><div class="t_fin-black-txt"><spring:message code="label.amt_blckd" /></div></td></tr>
      			<tr><td><div class="t_fin-black-txt"><spring:message code="label.prepaid_actual_account" /></div></td></tr>
      		</table>
      		</td>
      		<td>
      		<table border="0">
      			<tr><td><div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bgRequired}"  pattern="${numberPattern}" /></div></td></tr>
      			<tr><td><div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bgPaid}"  pattern="${numberPattern}" /></div></td></tr>
      			<tr><td><div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bankGuaranteeBalance}"  pattern="${numberPattern}" /></div></td></tr>
      			<tr><td><div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.reservedAccBalance}"  pattern="${numberPattern}" /></div></td></tr>
      			<tr><td><div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.prepaidAccBalance - CompanyInformationInfo.reservedAccBalance}"  pattern="${numberPattern}" /></div></td></tr>
      			<tr><td><div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.prepaidAccBalance}"  pattern="${numberPattern}" /></div></td></tr>
      		</table>
      		
<%--         <ul>

         <li>
            <div class="t_fin-black-txt"><spring:message code="label.bg_req" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bgRequired}"  pattern="${numberPattern}" /></div>
          </li>

          <li>
            <div class="t_fin-black-txt"><spring:message code="label.bg_paid" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bgPaid}"  pattern="${numberPattern}" /></div>
          </li>
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.bg_bal" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.bankGuaranteeBalance}"  pattern="${numberPattern}" /></div>
          </li>
        
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.prepaid_actual_account" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.prepaidAccBalance}"  pattern="${numberPattern}" /></div>
          </li>
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.amt_blckd" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.prepaidAccBalance - CompanyInformationInfo.reservedAccBalance}"  pattern="${numberPattern}" /></div>
          </li>
          <li>
            <div class="t_fin-black-txt"><spring:message code="label.prepaid_reserve_account" /></div>
            <div class="t_fin-grey-txt"><fmt:formatNumber value="${CompanyInformationInfo.reservedAccBalance}"  pattern="${numberPattern}" /></div>
          </li> 
        </ul> --%>
        
        </td></tr>
      </table>
      
        
      </div>
      
      
       <!-- Jq Grid Start -->	
	  <div class="t_grid-container" style="width: 338px;">
	  <table id="listNotifications"></table>
	  <div class="t_grid-footer"><button onclick="documentLocationFixed('admin/general/inbox/notifications/show.htm');" class="button_small"><spring:message code="button.view_all" /></button></div>
	  </div>
	  <!-- Jq Grid End -->
	  <div class="t_grid-container1" style="width: 338px;">
        <table id="listTasks"></table>
	    <div class="t_grid-footer"><button onclick="documentLocationFixed('admin/general/inbox/tasks/show.htm');" class="button_small"><spring:message code="button.view_all" /></button></div>
        
      </div>
    

    <!--Middle Right Close-->
<script type="text/javascript">

   $(".topnav").accordion({
		accordion:false,
		speed: 500,
		closedSign: '<img src=\'resources/images/common/close.jpg\' />',
		openedSign: '<img src=\'resources/images/common/open.jpg\' />'
	});
	
	 
   
   $('#listNotifications').jqGrid({
		datatype :'json',
		url		 :'displayUserNotification.json?min=true',
		colNames : [ 
					 '<spring:message code="grid.columnname.subject" />',
			  		 '<spring:message code="grid.columnname.reference_no" />', 
			  		 '<spring:message code="grid.columnname.date_received" />'
			  		] ,
		
		colModel : [
		  {name:'subject',index:'subject', width:120, sortable : true}, 
		  {name:'reference',index:'reference', width:120,sortable : true}, 
		  {name:'receivedon',index:'receivedon', width:150, sortable : true},
		 ],
		height:235,
		rowNum: 15,
		autowidth: true, 
		viewrecords: true,
		rowList:[10,20,30], 
		pager: jQuery('#pager'), 
		sortname: 'id', 
		viewrecords: true, 
		sortorder: "asc", 
		hidegrid: false,
		caption : '<spring:message code="menu.label.notifications" />'
		<c:if test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		, direction:'rtl'
		</c:if>									
	});	



	$('#listTasks').jqGrid({
		datatype :'json',
		url		 :'displayUserTasks.json?min=true',
		colNames : [  '<spring:message code="grid.columnname.task_name" />',
		              '<spring:message code="grid.columnname.service_name" />',
				  		 '<spring:message code="grid.columnname.reference_no" />' ],
		
		colModel : [
		  
		  {name:'taskname',index:'taskname', width:150, sortable : true}, 
		  {name:'senton',index:'senton', width:100, sortable : true}, 
		  {name:'status',index:'status', width:150, sortable : true}
		 ],
		height:235,
		rowNum: 15,
		autowidth: true, 
		viewrecords: true,
		rowList:[10,20,30], 
		pager: jQuery('#pager'), 
		sortname: 'id', 
		viewrecords: true, 
		sortorder: "asc", 
		hidegrid: false,
		caption : '<spring:message code="menu.label.tasks" />'
		<c:if test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		, direction:'rtl'
		</c:if>									
	});
	
	$(document).ready(function (){
		$("#showMedicalTypeBeforeSelect").show();			
		$("#showMedicalTypeAfterSelect").hide();
		
		setInterval(function(){  jQuery("#listTasks").trigger("reloadGrid"); },60000);
		setInterval(function(){  jQuery("#listNotifications").trigger("reloadGrid"); },60000);
	});
	
	var medicalTypeLabel;
	
	function changed(obj) {
		if($.browser.msie && $.browser.version.substr(0,1)<7){
			medicalTypeLabel = $("#cuselFrame-medicalType .cuselText").html();
		} else {
			medicalTypeLabel = $("#medicalType option:selected").text();
		}		
	}
	
	function submit(){
		if($("#medicalType").val() != '') {
			$.getJSON("getMedicalTypeShow.json?medicalType=" + $("#medicalType").val(), function(){
				$("#showMedicalTypeBeforeSelect").hide();
				$("#showMedicalTypeAfterSelect").text(medicalTypeLabel);
				$("#showMedicalTypeAfterSelect").show();
			});			
		} else {
			var errors = '<ul>' + 'The field is required ' + '[' + '<spring:message code="label.medical_type" />'  + ']' + '</ul>';
			jAlert('error', errors,
					'<spring:message code="label.errormessage" />');
		}
	};	
	
</script>